package com.example.demo528.controller;

import com.example.demo528.domain.Test;
import com.example.demo528.service.TestService;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class TestController {
    @Value("${test.hello}")
    private String testHello;
    @Resource
    private TestService testService;

    //    @GetMapping("/hello")
    @RequestMapping(value = "/hello",method = RequestMethod.GET)
    public String hello(){
        return "hello world"+testHello;
    }
    @PostMapping("/hello/post")
    public String helloPost(String name){
        return "hello worldPost,"+name;
    }

    @RequestMapping("/test/list")
    public List<Test> list(){
        return testService.list();
    }
}
